package com.be.beadmin.system.controller.ProjectDesignController;

import com.be.beadmin.common.utils.ResultModel;


import com.be.beadmin.design.service.BomReviewService;
import com.be.beadmin.system.service.ProjectDesignSevice.BomReviewPdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.List;

/**
 * @Author: Mengyang Zhu
 * @Date: 2023/10/3 0:10
 * @Description: BomReviewController
 */
@Api(tags = {"Bom"})
@RestController
public class BomReviewPdController {

    @Autowired
    private BomReviewPdService bomReviewPdService;


    @ApiOperation("初始审核")
    @PostMapping("/design/confirmBomReview")
    public ResultModel confirmBomReview(
            @ApiParam(value = "id", required = true) @RequestParam String id,
            @ApiParam(value = "审核状态", required = true) @RequestParam int reviewState,
            @ApiParam(value = "审核备注") @RequestParam(required = false) String reviewMemo) throws ParseException {

        bomReviewPdService.confirmBomReview(id,reviewState,reviewMemo);
        return ResultModel.success("审核完成！");
    }


//    @ApiOperation("确认审核,通过=2；驳回=3")
//    @PostMapping("/design/confirmBomReviewVersion2")
//    public ResultModel confirmBomReviewVersion2(
//            @ApiParam(value = "ids", required = true) @RequestParam List<String> ids,
//            @ApiParam(value = "审核状态", required = true) @RequestParam int reviewState,
//            @ApiParam(value = "审核备注") @RequestParam(required = false) String reviewMemo) throws ParseException {
//
//        bomReviewPdService.confirmBomReviewVersion2(ids,reviewState,reviewMemo);
//        return ResultModel.success("审核完成！");
//    }


    @ApiOperation("确认审核,通过=2；驳回=3")
    @PostMapping("/design/confirmBomReviewVersion2")
    public ResultModel confirmBomReviewVersion2(
            @ApiParam(value = "id", required = true) @RequestParam String id,
            @ApiParam(value = "version", required = true) @RequestParam Integer version,
            @ApiParam(value = "versionSecond", required = true) @RequestParam Integer versionSecond,
            @ApiParam(value = "审核状态", required = true) @RequestParam int reviewState,
            @ApiParam(value = "审核备注") @RequestParam(required = false) String reviewMemo,
            @ApiParam(value = "version_pre", required = true) @RequestParam Integer version_pre,
            @ApiParam(value = "versionSecond_pre", required = true) @RequestParam Integer versionSecond_pre
            ) throws ParseException {

        bomReviewPdService.confirmBomReviewVersion2(id,reviewState,reviewMemo, version, versionSecond, version_pre, versionSecond_pre);
        return ResultModel.success("审核完成！");
    }
}
